﻿Public Class formvncinstall

    Private Sub btnpsexec_Click(sender As Object, e As EventArgs) Handles btninstall.Click
        Dim ruta As String
        Dim dirvnc As String
        Dim parametros As String
        Dim Parametros2
        Dim ipinstall As String
        ipinstall = textipinstall.Text
        dirvnc = "C:\VNCTP\VNCTP.exe"
        ruta = "c:\windows\psexec.exe"
        parametros = "-c -f"
        Parametros2 = "net user uvnc Georgina69 /ADD"

        lbnping.Text = ""
        lbnprogress.Text = ""

        If Not System.IO.File.Exists("c:\VNCTP\VNCTP.exe") Then

            My.Computer.FileSystem.CopyFile("C:\Program Files\TechTools\VNCTP.exe", "C:\Program Files\TechTools\VNCTP\VNCTP.exe", overwrite:=True)
            My.Computer.FileSystem.CopyFile("C:\Program Files\TechTools\listaIP.txt", "C:\Program Files\TechTools\VNCTP\listaIP.txt", overwrite:=True)
            My.Computer.FileSystem.CopyDirectory("C:\Program Files\TechTools\VNCTP\", "C:\VNCTP\", True)
            lbnprogress.Text = "Coping VNC DIR ...."

        End If

        If textipinstall.Text = "" Then

            MsgBox("Please Insert a IP", MsgBoxStyle.Exclamation)
            Return
        End If


        If My.Computer.Network.Ping(ipinstall) = True Then

            lbnprogress.Text = "Instalando VNC......"
            Shell(ruta & " " & "\\" & ipinstall & " " & Parametros2, vbHidden)
            Shell(ruta & " " & parametros & " " & "\\" & ipinstall & " " & dirvnc, vbNormalFocus)

            lbnprogress.Text = ""

        Else
            lbnping.Text = " The IP Address is shutdown or incorrect"
            lbnprogress.Text = "Install Aborted"
        End If

        textipinstall.Clear()



    End Sub

    Private Sub btnclose_Click(sender As Object, e As EventArgs) Handles btnclose.Click
        Me.Close()

    End Sub

    Private Sub formvncinstall_Load(sender As Object, e As EventArgs) Handles MyBase.Load

      

       

    End Sub
End Class